module.exports = {
  defaultSeverity: 'error',
  extends: ['stylelint-config-standard'],
  plugins: ['stylelint-scss', 'stylelint-order'],
  rules: {
    'declaration-block-trailing-semicolon': false,
    'order/order': [
      'declarations',
      'custom-properties',
      'dollar-variables',
      'rules',
      'at-rules',
    ],
    'font-family-no-missing-generic-family-keyword': null,
    'at-rule-no-unknown': null,
    'scss/at-rule-no-unknown': true,
    // 不要使用已被 autoprefixer 支持的浏览器前缀
    'media-feature-name-no-vendor-prefix': true,
    'at-rule-no-vendor-prefix': true,
    'selector-no-vendor-prefix': true,
    'property-no-vendor-prefix': true,
    'value-no-vendor-prefix': true,
    'no-empty-source': null,
    // 最多允许嵌套20层，去掉默认的最多2层
    'max-nesting-depth': 20,
    // 颜色值要小写
    'color-hex-case': 'lower',
    // 不能用important
    'declaration-no-important': null,
    'selector-class-pattern': [
      '^([a-z][a-z0-9]*)((-|__)[a-z0-9]+)*$',
      {
        message:
          'Selector should be written in lowercase with hyphens (selector-class-pattern)',
      },
    ],
    'property-no-unknown': [
      true,
      {
        ignoreProperties: ['box-orient'],
        ignoreAtRules: ['function', 'if', 'each', 'include', 'mixin', 'for'],
      },
    ],
    'unit-no-unknown': [
      true,
      {
        ignoreUnits: ['rpx'],
      },
    ],
    'selector-pseudo-class-no-unknown': [
      true,
      {
        ignorePseudoClasses: [':export'],
      },
    ],
  },
};
